/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.vti.sisp_sicrim.model.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import br.com.crud4j.core.model.Model;
import br.com.vti.sisp_sicrim.model.entity.enums.Status;

/**
 *
 * @author ednardomatos
 */
@Entity
@Table(name = "t_incidencia", catalog = "desenvolvimento", schema = "e_sisp_sicrim")
@SequenceGenerator(name = "seq_incidencia", sequenceName = "e_sisp_sicrim.seq_incidencia", initialValue = 1, allocationSize = 1)
public class Incidencia implements Model<Integer> {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_incidencia")
    @Basic(optional = false)
    private Integer id;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "dt_registro")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dtRegistro;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "nr_oficio")
    private String nrOficio;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "dt_oficio")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dtOficio;
    
    @Column(name = "mandado_prisao")
    private Boolean mandadoPrisao;
    
    @Column(columnDefinition="bpchar(1) default = 'A'")
    private Status status;
    
    @JoinColumn(name = "delegacia", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Delegacia delegacia;

    public Incidencia() {
    }

    public Incidencia(Integer id) {
        this.id = id;
    }

    public Incidencia(Integer id, Date dtRegistro, String nrOficio, Date dtOficio) {
        this.id = id;
        this.dtRegistro = dtRegistro;
        this.nrOficio = nrOficio;
        this.dtOficio = dtOficio;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDtRegistro() {
        return dtRegistro;
    }

    public void setDtRegistro(Date dtRegistro) {
        this.dtRegistro = dtRegistro;
    }

    public String getNrOficio() {
        return nrOficio;
    }

    public void setNrOficio(String nrOficio) {
        this.nrOficio = nrOficio;
    }

    public Date getDtOficio() {
        return dtOficio;
    }

    public void setDtOficio(Date dtOficio) {
        this.dtOficio = dtOficio;
    }

    public Boolean getMandadoPrisao() {
        return mandadoPrisao;
    }

    public void setMandadoPrisao(Boolean mandadoPrisao) {
        this.mandadoPrisao = mandadoPrisao;
    }

    public Delegacia getDelegacia() {
        return delegacia;
    }

    public void setDelegacia(Delegacia delegacia) {
        this.delegacia = delegacia;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Incidencia)) {
            return false;
        }
        Incidencia other = (Incidencia) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.vti.sisp_sicrim.model.entity.Incidencia[ id=" + id + " ]";
    }

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}
    
}
